using System;
using System.Text;
using System.Globalization;
namespace Microsoft.CommerceServer.Catalog.Tools
{
	/// <summary>
	/// This class contains various validation routines.
	/// </summary>
	internal class Validations
	{
		/// <summary>
		/// Validates the site name.
		/// </summary>
		/// <param name="siteName"> The site name. Should not be null or an empty string. </param>
		internal static void ValidateSiteName(string siteName)
		{
			// Validate that the siteName is not null.
			if (siteName == null)
				throw new ArgumentNullException("siteName");
			// Validate that the site name is not an empty string.
			if (siteName.Length == 0)
			{
				throw new ArgumentException(Errors.Validations_InvalidSiteName);
			}
		}

		/// <summary>
		///		Performs a culture-insensitive string comparison. 
		/// </summary>
		/// <param name="stringA"> The first string to compare. </param>
		/// <param name="stringB"> The second string to compare. </param>
		/// <param name="ignoreCase"> <see langword="true"/> To ignore the case of the string </param>
		/// <returns> Zero if strings are equal. Returns the less-than character if the first string is shorter.
		/// Returns a greater-than chracter if the first string is longer. </returns>
		internal static int DBCompareString(string stringA, string stringB, bool ignoreCase)
		{
			if (ignoreCase)
				return string.Compare(stringA, stringB, StringComparison.InvariantCultureIgnoreCase);
			else
				return string.Compare(stringA, stringB, StringComparison.InvariantCulture);
		}
	}
}
